Writing is also not the product of grammar. All grammar rules were formulated only after inventing script and writing. Letters and words are the written form of different sounds we uses in our talking. In that sense talking and writing are same. If a person learns the written form of sounds in a particular language (alphabets), he can write & read all the things he speaks. Letters and writing invented mainly for overcoming the time and distance limitations of talking. There is no standard format of writing also. Like talking, in writing also there are many ways, usages, styles and orders.